const App = getApp();
const navigationBarHeight = (getApp().diygwstatusBarHeight + 44) + 'px'
Page({
    data: {
        msgs1:[],

    },

    //弹出提示信息
    showModal(message) {
        App.WxService.showModal({
            title: '友情提示',
            content: message,
            showCancel: !1,
        });
    },
    onShareAppMessage: function() {},

    //页面加载
    onLoad(option) {
        if (option) {
            this.setData({
                globalOption: option
            })
        }
    },

    //页面显示
    onShow() {
        this.getMsgs1();

    },

    //页面跳转
    navigateTo(e) {
        App.navigateTo(e.currentTarget.dataset.url, e.currentTarget.dataset);
    },
    
getMsgs1() {
    //设置要传递的参数
    let param = {
        f: 1,
        uid: wx.getStorageSync("uid"),
        loadmsg: `正在加载中`
    };

    App.HttpService.getData(param, "/reimburse_List").then(data => { //执行服务器Servlet
        this.setData({
            msgs1: data //把从服务器端得到的值赋值给数组
        });
    });
},

    dele(e) {
        var that = this;
        const dataset = e.currentTarget.dataset;
        let param = {
            f: 1,
            id: dataset.id
        };
        App.WxService.showModal({
            title: '友情提示',
            content: '您确定要执行此操作吗？',
        }).then(data => {
            if (data.confirm == 1) {
                App.HttpService.delData(param, "/reimburse_Delete").then(data => {
                    App.WxService.showToast({
                        title: "操作成功!",
                        icon: 'success',
                        duration: 1500,
                    });
                    setTimeout(function () {
                        that.getMsgs1();
                    }, 1500)


                });
            }
        })
    },

})